import Probability from '../../utils/probability';

const swiperList = [
  {
    value: `cloud://cloudbase-7g2qsnbke2a72ab7.636c-cloudbase-7g2qsnbke2a72ab7-1354295505/微信图片_2025-05-20_210611_716.jpg`,
    ariaLabel: '图片1',
  },
  
];

Page({
  data: {

    imageSrc: 'https://tdesign.gtimg.com/mobile/demos/image1.jpeg',
    value: '/pages/index/index',
    list: [
      { value: '/pages/index/index', icon: 'home', ariaLabel: '首页' },
      { value: '/pages/template/index', icon: 'file', ariaLabel: '模版' },
      // { value: '/pages/evaluating/index', icon: 'app', ariaLabel: 'AI简历测评' },
      // { value: '/pages/introduction/index', icon: 'chat-bubble-1', ariaLabel: 'AI自我介绍建议' },
      { value: '/pages/AI/index', icon: 'logo-adobe-illustrate', ariaLabel: 'AI助手' },
      // { value: 'label_3', icon: 'user', ariaLabel: '我的' },
    ],
    current: 1,
    autoplay: true,
    duration: 500,
    interval: 5000,
    swiperList,
  },



  onChange(e) {
    // this.setData({
    //    value: e.detail.value,  
    // });
    // console.log(e.detail.value)
    wx.switchTab({
      url: e.detail.value,
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.getOpenId()
    // console.log(Probability.testDistribution())
  },
  createResume() {
    wx.navigateTo({
      url: '/pages/createResume/index',
    })
  },

  evaluating() {
    wx.navigateTo({
      // url: '/pages/templateDetails/index',
      url: '/pages/evaluating/index',
    })
  },

  mbti() {
    wx.navigateTo({
      url: '/pages/mbti/index',
    })
  },

  interview() {
    wx.navigateTo({
      url: '/pages/interview/index',
    })
  },

  previewImage(e) {
    const id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: `/pages/templateDetails/index?id=${id}`,
    })
    console.log(id)
  },



  getOpenId() {
    wx.showLoading({
      title: '',
    });
    wx.cloud.callFunction({
      name: 'quickstartFunctions',
      data: {
        type: 'getOpenId'
      }
    }).then((resp) => {
      this.setData({
        haveGetOpenId: true,
        openId: resp.result.openid,
        record: resp.result.template.data
      });
      wx.setStorageSync('openId', resp.result.openid)
      wx.setStorageSync('aiNumber', resp.result.aiNumber)
      wx.hideLoading();
    }).catch((e) => {
      wx.hideLoading();
      console.log(e)
    });
  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
});
